<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<input type="hidden" value="${model.userid}" name="userid">
<div class="form-horizontal">
    <div class="form-group">
        <label class="control-label col-md-2">撰稿人</label>
        <div class="col-md-10">
            <input id="nickname" name="nickname" class="form-control" placeholder="请输入撰稿人"
                   value="${model.nickname}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">性别</label>
        <div class="col-md-10">
            <select name="sex" class="form-control">
                <option value="0">请选择</option>
                <option value="2" <c:if test="${model.sex==2}"> selected="selected"</c:if>>女</option>
                <option value="1" <c:if test="${model.sex==1}"> selected="selected"</c:if>>男</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">头像</label>
        <div class="col-md-10">
            <input type="hidden" name="headimg" value="${model.headimg}"/>
            <input type="file" class="btn btn-primary" name="HeadImg"/>
            <img src="http://img.readerday.com/face/${model.headimg}" class="thumbnail" style="height: 200px;
            <c:if test="${model.headimg==null}">display: none;</c:if> ">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">签名</label>
        <div class="col-md-10">
            <textarea name="signature" id="signature" cols="30" rows="10" class="form-control" placeholder="请输入签名" >${model.signature}</textarea>
        </div>
    </div>
</div>

<div class="form-group">
    <div class="col-md-offset-2 col-md-10">
        <button type="submit" class="btn btn-primary">
            <i class="fa fa-floppy-o"></i> 保存
        </button>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {

        $("#form1").bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                nickname: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                },
                sex: {
                    validators: {
                        regexp: {
                            regexp: /^[1-2]*$/,
                            message: '必须选择其中的一个'
                        }
                    }
                },
                signature: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                }
            }
        });
    });
</script>